package com.silence.springboot.controller;

import com.silence.springboot.common.Result;
import com.silence.springboot.service.LoginAdminService;
import com.silence.springboot.vo.input.LoginSystemInput;
import com.silence.springboot.vo.output.LoginSystemOutput;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 登录表 控制层。
 *
 * @author mybatis-flex-helper automatic generation
 * @since 1.0
 */
@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping("/login/admin")
@Tag(name = "管理人员登录", description = "管理人员登录 控制层")
public class LoginAdminController {

    /**
     * 登录表 服务层
     */
    private final LoginAdminService loginAdminService;

    /**
     * 登录系统
     *
     * @param input 登录表实体类
     */
    @PostMapping("/loginSystem")
    @Operation(summary = "管理人员登录", description = "管理人员登录")
    public Result<LoginSystemOutput> loginSystem(@Validated @RequestBody LoginSystemInput input) {
        // 返回成功
        return Result.success(loginAdminService.loginAdminSystem(input));
    }

}